/*
 * @Author: anshengtyp
 * @Date: 2024-03-28 11:35:50
 * @LastEditTime: 2024-08-20 09:48:54
 * @LastEditors: anshengtyp 1815634838@qq.com
 * @Description: 
 */

import router from './router';
import NProgress from 'nprogress';
import { getToken } from '@/utils/auth';
NProgress.configure({ showSpinner: false });

router.beforeEach((to, from, next) => {
  NProgress.start();
  if (to.path === '/noAuth') {
    next();
  } else if (getToken()) {
    next();
  } else {
    next('/noAuth');
  }
})

router.afterEach(() => {
  NProgress.done()
})